var $ = require("jquery");
var nav = require("./nav.js");
var util = require("./util.js");
module.exports = {
    initNav: function(ifShowBack, label, rightHtml, event){
        this.init();
        nav.init(ifShowBack, label, rightHtml, event);
    },
    init: function(){
        if(!util.getUserStore()) {
            if(window.location.pathname!= '/html/login') {
                util.changePage("./login?fromUrl=" + encodeURIComponent(window.location.pathname));
            }
        }
        this.initAnchor();
        $("html").css("font-size", $(window).width()/640*16+'px');
        $("#app").css("min-height", $(window).height());
    },
    initAnchor: function () {
        $("body").on("click", "a", function () {
            var href = $(this).attr("href") || "#";
            util.changePage(href);
            return false;
        });
    }
};